import { createApp } from 'vue'
import 'vfonts/Lato.css'
import '@styles/tailwind.css'
import '@styles/global.less'
import { createPinia } from 'pinia'
import Vconsole from 'vconsole'
import AppProvider from '@cmps/Application/index.vue'
import App from './App.vue'
import router, { setupRouter } from './router'

const isDev = import.meta.env.MODE === 'development'
const appProvider = createApp(AppProvider)
appProvider.mount('#appProvider', true)
const app = createApp(App)
app.provide('isDev', isDev)
app.use(createPinia())
isDev && app.use(new Vconsole())
setupRouter(app)

router.isReady().then(() => {
  const meta = document.createElement('meta')
  meta.name = 'naive-ui-style'
  document.head.appendChild(meta)
  app.mount('#app', true)
})
